const express = require('express')
const path = require('path')
const app = express()
const { out_dir, server_test_port } = require('./config')
const port = server_test_port
const BUILD_PATH = out_dir
const debug = console.log.bind(console)

app.use(express.static(BUILD_PATH))

app.get('/*', function (req, res) {
  res.sendFile(path.join(__dirname, `./${BUILD_PATH}`, 'index.html'))
})

app.listen(port, () => {
  debug(``)
  debug(`Success!!!, Welcome to Vite\nPort:${port}`)
  debug(``)
})
